/*
* ECARX Technology Limited is the owner of the copyright and the trade secret of this software.
* Without permission, no one has the right to obtain, disclose or use this software in any way.
*/

package ecarx.xsf.notificationcenter.wrapper;

import android.os.RemoteException;
import android.service.notification.StatusBarNotification;

import ecarx.eas.notification.StatusBarTyrantNotification;
import ecarx.eas.notification.interfaces.OnNotificationListener;
import ecarx.xsf.notificationcenter.notification.INotificationListener;

/**
 * FileName: NotificationListenerWrapper.java <br>
 * Description : 通知数据监听封装 <br>
 * Create Time: 2021/8/19 17:03 <br>
 * Update Time: 2021/8/19 17:03 <br>
 *
 * @since 1.0.0
 */
public class NotificationListenerWrapper extends INotificationListener.Stub {

    private OnNotificationListener listener;

    public NotificationListenerWrapper(OnNotificationListener listener) {
        this.listener = listener;
    }

    @Override
    public void onNotificationPosted(StatusBarNotification notification) throws RemoteException {
        if (listener != null) {
            listener.onNotificationPosted(notification);
        }
    }

    @Override
    public void onNotificationRemoved(StatusBarNotification notification) throws RemoteException {
        if (listener != null) {
            listener.onNotificationRemoved(notification);
        }
    }

    @Override
    public void onTyrantNotificationPost(StatusBarTyrantNotification notification) throws RemoteException {
        if (listener != null) {
            listener.onTyrantNotificationPost(notification);
        }
    }

    @Override
    public void onTyrantNotificationRemoved(StatusBarTyrantNotification notification) throws RemoteException {
        if (listener != null) {
            listener.onTyrantNotificationRemoved(notification);
        }
    }
}
